/*
 * @ PrimeNumbers.java
 *
 */

import java.util.InputMismatchException;
import java.util.Scanner;

/**
* The class PrimeNumbers  
* displays a list of prime numbers.
*
* @version 1.01 
* @date    18.01.2013
* @author  Yaroslav Tabachnyy
* @email   Yaroslav.Tabachnyy@gmail.com
*/
 
public class PrimeNumbers {

    public static void main(String[] args) {

        Scanner in = new Scanner(System.in);
        System.out.println
		("Input positive integer value upper limit for prime numbers list:");
        
		int upperPrimesLimit = 0;
        
		try {
            upperPrimesLimit = in.nextInt();
        } catch (InputMismatchException e) {
            System.err.println
			("Your number must be a positive integer value!");
        } finally {
            in.close();
        }
        if (upperPrimesLimit < 0) {
            System.err.println
			("Your number must be a positive integer value!");
            return;
        }
 
 for (int i = 2; i <= upperPrimesLimit; i++) {
            boolean isPrime = true;
            for (int j = 2; j < i; j++) {
                if (i % j == 0) {
                    isPrime = false;
                }
            }                       
            if (isPrime) {
                System.out.print(i + " ");
            }
        
		}
    
	}

}